package com.etc.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.etc.dao.LineupDao;
import com.etc.service.LineupService;
@Service(value="lineupService")
public class lineupServiceImpl implements LineupService {

	@Autowired
	private LineupDao lineupdao;
	@Override
	@Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
	public int insertLineup(int userId, int sellerId) {
		// TODO Auto-generated method stub
		int lineupNo =selectMaxLineupNo(sellerId);
		lineupdao.insertLineup(userId, sellerId, lineupNo+1);
		return selectMaxLineupNo(sellerId);
	}
	@Override
	public int selectMaxLineupNo(int sellerId) {
		// TODO Auto-generated method stub
		return lineupdao.selectMaxLineupNo(sellerId);
	}

}
